(function(angular) {
	'use strict';
	angular.module("fs.waf").factory("tradePartnerService", tradePartnerService);
	tradePartnerService.$inject = [ '$q', 'loggerFactory', 'ajaxServiceFactory' ];
	function tradePartnerService($q, loggerFactory, ajaxServiceFactory) {
		var log = loggerFactory.getLogger("tradePartnerService");
		var ajaxService = ajaxServiceFactory.buildAjaxService({
			getCompanyType : {
				url : 'do/cda/dataList/companyType',
				method : 'post'
			}
		});

		function getCompanyType() {
			var defer = $q.defer();
			var companyOptions = [];
			ajaxService.getCompanyType().then(function(response) {
			if(response.data){
				angular.forEach(response.data, function(data, index, array){
					companyOptions.push({"value" : data.value, "label" : data.value});
				});
			}
			defer.resolve(companyOptions);
			}, angular.noop);
			return defer.promise;
		};
		
		return {
			getCompanyType : getCompanyType
		};
	}
})(angular);